
const { resolve } = require("path")
const HtmlWebpackPlugin = require("html-webpack-plugin")


module.exports = {
    entry: "./src/index.js",
    output: {
        filename: "bundle.js",
        path: resolve(__dirname, "bundle")
    },
    module: {
        rules: [
            /*
                语法检查: eslint-loader eslint
                只检查源代码，不检查第三方库
                设置检查规则：
                    在package.json中的eslintConfig中设置
                      "eslintConfig": {
                            "extends": "airbnb-base"
                        }
                    airbnb ---> eslint-config-airbnb-base eslint-plugin-import eslint 
            */
            {
                test: /\.js$/,
                exclude: /node_modules/,
                loader: "eslint-loader",
                options: {
                    // 自动修复exlint的错误
                    fix: true
                }
            }
        ]
    },
    plugins: [
        new HtmlWebpackPlugin({
            template: "./src/index.html"
        })
    ],
    mode: "development"
}